package com.boot.hystrix.controller;

import com.boot.hystrix.service.HelloService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * Created by Wuxiang on 2018/5/9
 *
 * 访问
 * http://localhost:8080/hello1/wx
 * http://localhost:8080/hello2/wx
 */
@RestController
public class HelloController {
    private static Logger logger = LoggerFactory.getLogger(HelloController.class);

    @Autowired
    private HelloService service;

    @RequestMapping("/hello1/{name}")
    public String hello1(@PathVariable("name") String name) {
        logger.info("hello1请求时间:" + LocalDateTime.now());
        return service.helloName(name);
    }

    @RequestMapping("/hello2/{name}")
    public String hello2(@PathVariable("name") String name) {
        logger.info("hello2请求时间:" + LocalDateTime.now());
        return service.hello(name);
    }


}
